home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE19
/
EX2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-13
|
1KB
|
40 lines
// ex2.c
#include <windows.h>
#include <genstub.c>
#include <winreg.h>
LRESULT FAR PASCAL WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch( uMsg )
{
case WM_COMMAND: // process menu items
switch( wParam )
{
case IDM_TEST:
{
HKEY hKeyResult = 0;
LONG lResult = RegOpenKeyEx( HKEY_CLASSES_ROOT,
"MyDoc\\shell\\&Test\\command",
0, KEY_ALL_ACCESS, &hKeyResult );
if ( lResult == ERROR_SUCCESS ) // delete default value
lResult = RegDeleteValue( hKeyResult, NULL );
RegCloseKey( hKeyResult );
RegDeleteKey( HKEY_CLASSES_ROOT, "MyDoc" );
RegDeleteKey( HKEY_CLASSES_ROOT, ".MDC" );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default: // default windows message processing
return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
return( 0L );
}